We are attempting to find information about the flow of calcium. We will outline the method being used (for now) below. Following the outline I will examine it with simple test cases. I will use a simple 3D gaussian function to represent calcium concentrations. By shifting the guassian around to different locations we can simulate the notion of calcium movement within successive frames. We will take this foundation and construct different scenarios to explore the limits of the method. For example we will look at both wave like and diffusion like processes

  • The "slow" wave case where the gaussian is kept at constant amplitude and is translated only slightly
  • The "fast" wave case where the gaussian is kept at constant amplitude and is translated significantly
  • The "slow" diffusion case where the gaussian's amplitude is reduced while translating only slightly
  • The "fast" diffusion case where the gaussian's amplitude is reduced while translating it significantly.

If we can detect or approximate the "flow" i.e. which direction the gaussian moved to in these cases, then I will move on to more complicated test cases such as adding noise and multiple gaussians, etc.

Outline of the Method

We will approximate the flow within 5 frames at a time: $F_1,F_2,F_3,F_4,F_5$. The steps are enumerated below.

Spatial Denoising

  • Transform all 5 frames into the frequency domain via the Discrete Cosine Transform$^*$ $$\hat{F}_i = \text{DCT}(F_i)$$
  • Remove some of the higher modes with lower power to mitigate the influence of noise in the original signal. Practically, this translates to setting them equal to zero. $$\hat{F}_i[m_x: \hspace{3pt},m_y:] = 0$$ where the $m_x$ and $m_y$ are the locations where we truncate the modes.

Temporal Denoising

  • Still within the frequency domain we take a temporal average of the first 3 frames $\tilde{F}_2 = \frac{\hat{F}_1+\hat{F}_2+\hat{F}_3}{3}$ and the last three frames $\tilde{F}_4 = \frac{\hat{F}_3+\hat{F}_4+\hat{F}_5}{3}$. This averaging also "slows" down fast processes. This should help in the test cases where we examine fast diffusion and waves.

Temporal Derivative

  • Then we take the difference between these spatially denoised and temporally avergaed frames to approximate the temporal derivative. $$\frac{\partial \hat{F}_3}{\partial t} \approx \tilde{F}_4 - \tilde{F}_2$$

Fit a Surface

  • Then we transform back into cartesian space with the inverse DCT $$\frac{\partial F_3}{\partial t} \approx \text{DCT}^{-1}(\frac{\partial \hat{F}_3}{\partial t})$$
  • We down-sample the image for computational efficiency
  • Then fit it with a two dimensional cubic interpolant. We now have a smoothed, continuous ($C^3$ to be precise) representation of the temporal derivative.

Determine Flow

  • We then calculate the gradient of the temporal derivative which gives us our first approximation to the flow. This vector field is the union of the "correct" flow along with artifacts of the method. $$ \nabla \frac{\partial F_3}{\partial t}(x,y) \approx \bigg< \frac{\partial F_3}{\partial x \partial t}(x,y), \frac{\partial F_3}{\partial y \partial t}(x,y) \bigg>$$
  • To remove the artifacts we only keep the vectors whose magnitudes constitute the top 15% (this may need to be localized and not global)
  • Then only keep those vectors whose tails and heads have opposite signs on the approximate temporal derivative. For example, the vectors at location $x,y$ that we keep satisfy the following criteria. $$\nabla \frac{\partial F_3}{\partial t}\bigg (\frac{\partial F_3}{\partial x \partial t}(x,y), \frac{\partial F_3}{\partial y \partial t}(x,y) \bigg) * \nabla \frac{\partial F_3}{\partial t}(x,y) < 0 $$

Test Case 1: Slow Wave-like Movement

First we take a Gaussian and translate is over 5 frames a small distance. Such a Gaussian and its movement is shown below. We see the 5 2D plots below And also the 5 3D plots

  • First we transform into the frequency domain. We show the modes of frame 0 below. As expected, there is no noise becasue the signal was constructed directly from a gaussian

  • Normally we would remove some of the higher modes, but we will skip that here since there is no noise.
  • Next we average the first 3 and last 3 modes. We show the averages in both 2D and 3D for each set of frames below

Average of $F_1,F_2,F_3$

Average of $F_3,F_4,F_5$

  • Now we approximate the temporal derivative by taking the difference of these two averages

  • $^*$Discrete Cosine Transform
    • Mathematically the image is transformed as follows $$X_{k_1,k_2}=\sum_{n_1=0}^{N_1-1} \sum_{n_2=0}^{N_2-1} x_{n_1,n_2} \cos \bigg [ \frac{\pi}{N_1}(n_1+\frac{1}{2})k_1 \bigg ] \cos \bigg [ \frac{\pi}{N_2}(n_2+\frac{1}{2})k_2 \bigg ] \hspace{10pt} k_1 = 1,...,N_1-1, \hspace{5pt} k_2 = 1,...,N_2-1$$

In [ ]: